package com.flx.cloud.shop.admin.console;

import com.flx.cloud.shop.api.user.dto.UserDto;
import com.flx.cloud.shop.api.user.service.IUserService;
import com.flx.common.utils.result.ResultResponse;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Fenglixiong
 * @Create 2022/5/3 1:35
 * @Description
 **/
@Api
@Slf4j
@RestController
@RequestMapping("/user")
public class IUserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/get/{id}")
    public ResultResponse get(@PathVariable("id")Long id){
        return userService.get(id);
    }

    @PostMapping("/add")
    public ResultResponse add(@RequestBody UserDto user){
        return userService.add(user);
    }

    @PostMapping("/update")
    public ResultResponse update(@RequestBody UserDto user){
        return userService.update(user);
    }

    @GetMapping("/delete/{id}")
    public ResultResponse delete(@PathVariable("id")Long id){
        return userService.delete(id);
    }

}
